package gu.sql2java.excel.json;

import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

/**
 * JSON类型字段使用FASTJSON自定义反序列化器实现的数据导入适配器实现
 * @author guyadong
 * @since 3.29.0
 */
@SuppressWarnings("rawtypes")
public class FastjsonDeserializeHandler extends BaseJsonDeserializeHandler<ObjectDeserializer> {
	public FastjsonDeserializeHandler() {
		super();
	}
	public <T>FastjsonDeserializeHandler(ObjectDeserializer initDeserializer, Class<T> initType, T initEmptyValue) {
		super(initDeserializer, initType, initEmptyValue);
	}
	protected Object deserialize(String value,ObjectDeserializer deserializer,Class type) {
		ParserConfig mapping = new ParserConfig();
        DefaultJSONParser parser = new DefaultJSONParser(value, mapping);
        return deserializer.deserialze(parser, type, null);
	}
}
